package com.test.shiyan4;

import java.util.HashMap;
import java.util.Map;

public class Mymap {
    public static void main(String[] args) {
        // 1) 创建索引表
        Map<String, String> countryMap = new HashMap<>();
        countryMap.put("中国", "China");
        countryMap.put("美国", "American");
        countryMap.put("日本", "Japan");

        // 显示索引表
        System.out.println("初始索引表:");
        for (Map.Entry<String, String> entry : countryMap.entrySet()) {
            System.out.println(entry.getKey() + " -> " + entry.getValue());
        }

        // 2) 删除项目美国
        countryMap.remove("美国");

        // 再次显示索引表
        System.out.println("删除'美国'后的索引表:");
        for (Map.Entry<String, String> entry : countryMap.entrySet()) {
            System.out.println(entry.getKey() + " -> " + entry.getValue());
        }
    }
}
